home *** CD-ROM | disk | FTP | other *** search
/ QRZ! Ham Radio 1 / QRZ Ham Radio Callsign Database - December 1993.iso / ucsd / packet / tcpip / sys5 / iscwmpst.z / iscwmpst / tcp / misc / drv / miscdrv.db0ie
Encoding:
Text File  |  1991-06-22  |  1.6 KB  |  70 lines

  1. #include <sys/types.h>
  2. #include <sys/param.h>
  3. #include <sys/signal.h>
  4. #include <sys/immu.h>
  5. #include <sys/user.h>
  6. #include <sys/errno.h>
  7. #include <sys/sysmacros.h>
  8. #include <sys/map.h>
  9. #include <sys/mount.h>
  10. #include <sys/inode.h>
  11.  
  12. void msopen () {
  13. }
  14.  
  15. void msclose () {
  16. }
  17.  
  18. void msioctl (dev, cmd, addr, flag) caddr_t addr; {
  19.  
  20.         register struct map *mp;
  21.         struct inode *ip;
  22.         char *led;
  23.         int i, il, size, value;
  24.         ushort x[3];
  25.  
  26.         switch (cmd) {
  27.  
  28. .....
  29. case 201:       /* set real, effective and saved user ids */
  30.                 if (copyin (&x, addr, sizeof x))
  31.                         u.u_error = EFAULT;
  32.                 u.u_ruid = x[0];
  33.                 u.u_uid  = x[1];
  34.                 /* saved not supported in SYS V */
  35.                 break;
  36.  
  37. case 202:       /* set real, effective and saved group ids */
  38.                 if (copyin (&x, addr, sizeof x))
  39.                         u.u_error = EFAULT;
  40.                 u.u_rgid = x[0];
  41.                 u.u_gid  = x[1];
  42.                 /* saved not supported in SYS V */
  43.                 break;
  44. .....
  45. default:        u.u_error = EINVAL;
  46.                 break;
  47.         }
  48. }
  49.  
  50. $ static int miscdev = 0;
  51. int setresuid (r, e, s)
  52.         int r,e,s; {
  53.         short x[3];
  54.         int stat;
  55.         x[0]=r; x[1]=e; x[2]=s;
  56.         if (!miscdev) miscdev = open ("/dev/misc",0);
  57.         stat = ioctl (miscdev, 201, x);
  58.         return stat;
  59. }
  60. int setresgid (r, e, s)
  61.         int r,e,s; {
  62.         short x[3];
  63.         int stat;
  64.         x[0]=r; x[1]=e; x[2]=s;
  65.         if (!miscdev) miscdev = open ("/dev/misc",0);
  66.         stat = ioctl (miscdev, 202, x);
  67.         return stat;
  68. }
  69.